package rigo.ricard.pris.rs.ac.uns.dmi.actions;

import ai.aitia.dbinit.DbInitializer;
import ai.aitia.dbinit.beans.PortalConfig;

import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;

public class InitAction extends SimpleAction{

	private static final Log log = LogFactoryUtil.getLog(InitAction.class);
	
	public static final String VOCABULARY_NAME = "Car"; 
	
	@Override
	public void run(String[] arg0) throws ActionException {
		try {
			DbInitializer dbInitializer = new DbInitializer("/rigo/ricard/pris/rs/ac/uns/dmi/actions/db-init-vocabulary.xml");
			PortalConfig portalConfig = dbInitializer.execute();
			CacheRegistryUtil.clear();
			log.info("car vocabulaty added");
		} catch (Exception e) {
			log.error(e.getMessage());
		}
	}
	
}
